﻿using Ilongshi.Oversea.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ec_System.Service.Web
{
    public class ShopCartService
    {
        /// <summary>
        /// 根据ItemNumber and VendorNumber 获取库存
        /// </summary>
        /// <param name="itemNumber"></param>
        /// <param name="vendorNumber"></param>
        /// <returns></returns>
        public int GetStoreByItemNumber(string itemNumber, string vendorNumber)
        {
            var cmd = DataCommandManager.GetDataCommand("GetStoreByItemNumber");
            cmd.SetParameterValue("@ItemNumber", itemNumber);
            cmd.SetParameterValue("@VendorNumber", vendorNumber);

            return cmd.ExecuteScalar<int>();

        }

        /// <summary>
        /// 插入订单表
        /// </summary>
        /// <param name="orderXml"></param>
        /// <returns></returns>
        public int InsertOrder(string orderXml)
        {
            var cmd = DataCommandManager.GetDataCommand("InsertOrder");
            cmd.SetParameterValue("@OrderXml", orderXml);

            return cmd.ExecuteNonQuery();
        }
    }
}
